package com.dev.common.excel;

import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpServletResponse;

import com.dev.common.util.DateUtil;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;


/**
 * @Description excel 导入导出
 * @author Shiwen .Li
 * @date 2016年7月19日 下午9:04:43
 * @version V1.3.1
 */

public class ExcelUtil {
	/**
	 * 导出excel
	 * 
	 * @param wb
	 * @param response
	 * @throws IOException
	 */
	public static void export(HSSFWorkbook wb, HttpServletResponse response)
			throws IOException {
		String xlsName = DateUtil.format2str(new Date(), "yyyymmddHHMMss")
				+ ".xls";
		response.setContentType("application/vnd.ms-excel");
		response.setHeader("Content-disposition", "attachment;filename="
				+ xlsName);
		OutputStream ouputStream = response.getOutputStream();
		wb.write(ouputStream);
		ouputStream.flush();
		ouputStream.close();
	}

	/**
	 * 导入excel数据
	 * 
	 * @param file
	 * @return
	 */
	public List<Object> importFile(File file) {

		return null;
	}
}
